package com.jxw.database;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.jxw.constant.Constant;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/* loaded from: classes.dex */
public class QuanXianDatabaseHelper extends SQLiteOpenHelper {
    private static final String DB_CREATE_CONTACTS = "create table if not exists quanxian_info_table(_id INTEGER primary key autoincrement,setname TEXT,checked TEXT)";
    private static final String DataBaseName = "QuanXianInfo.db";
    private static final int version = 1;

    @Override // android.database.sqlite.SQLiteOpenHelper
    public void onUpgrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
    }

    public QuanXianDatabaseHelper(Context context) {
        super(context, DataBaseName, null, 1, null);
    }

    @Override // android.database.sqlite.SQLiteOpenHelper
    public void onCreate(SQLiteDatabase sQLiteDatabase) {
        Log.i("Tag", "===test:===create table if not exists quanxian_info_table(_id INTEGER primary key autoincrement,setname TEXT,checked TEXT)");
        sQLiteDatabase.execSQL(DB_CREATE_CONTACTS);
    }

    public void insertRow(ContentValues contentValues) {
        getWritableDatabase().insert(Constant.QUANXIAN_INFO_TABLE, null, contentValues);
    }

    public void updateRow(String str, int i) {
        ContentValues contentValues = new ContentValues();
        contentValues.put(Constant.CHECKED, Integer.valueOf(i));
        getWritableDatabase().update(Constant.QUANXIAN_INFO_TABLE, contentValues, "setname=?", new String[]{str});
    }

    public List<Map<String, Object>> queryInfo(String str) {
        ArrayList arrayList = new ArrayList();
        Cursor query = getReadableDatabase().query(Constant.QUANXIAN_INFO_TABLE, new String[]{Constant.SETNAME, Constant.CHECKED}, "setname=?", new String[]{str}, null, null, null);
        while (query.moveToNext()) {
            HashMap hashMap = new HashMap();
            hashMap.put(Constant.SETNAME, query.getString(query.getColumnIndex(Constant.SETNAME)));
            hashMap.put(Constant.CHECKED, query.getString(query.getColumnIndex(Constant.CHECKED)));
            arrayList.add(hashMap);
        }
        return arrayList;
    }
}
